<?php
require_once 'PHPUnit/Framework.php';

require_once dirname(__FILE__).'/../../../core/core.php';
CCore::Using('mime.charsets');

/**
 * Test class for CCoreMimeCharsets.
 */
class CCoreMimeCharsetsTest extends PHPUnit_Framework_TestCase
{
	/**
	 * @var CCoreMimeCharsets
	 */
	protected $object;

	protected function setUp()
	{
		$this->object = new CCoreMimeCharsets('utf-8');
	}

	public function testGetCharset()
	{
		$this->assertEquals($this->object->GetCharset(), 'utf-8');
	}

	public function testSetCharset()
	{
		$this->object->SetCharset('windows-1251');
		$this->assertEquals($this->object->GetCharset(), 'windows-1251');

		$this->object->SetCharset('utf-8');
		$this->assertEquals($this->object->GetCharset(), 'windows-1251');

		$this->object->SetCharset('utf-8', true);
		$this->assertEquals($this->object->GetCharset(), 'utf-8');
	}
}
